package socket.BIO_NIO_AIO.bio;

public class Calculator {

    public synchronized static String cal(String expression) {
        int a = Integer.parseInt(expression.charAt(0) + "");
        char cal = expression.charAt(1);
        int b = Integer.parseInt(expression.charAt(2) + "");

        if(cal == '+') {
            int i = a + b;
            return String.valueOf(i);
        } else if(cal == '-') {
            int i = a - b;
            return String.valueOf(i);
        } else if(cal == '*') {
            int i = a * b;
            return String.valueOf(i);
        } else {
            int i = a / b;
            return String.valueOf(i);
        }
    }
}
